#include <malloc.h>
#include <stdlib.h>
#include <stdio.h>

#include "mul_preparation.h"

void initial_mul_list( mul_list* list )
{
/*	list = (mul_list*)malloc(sizeof(mul_list)) ;*/
	list->length = 0 ;
}

void destroy_mul_list( mul_list* list )
{
	free(list) ;
}

int is_mul_list_empty( mul_list* list )
{
	return (list->length == 0) ;
}

int is_mul_list_full( mul_list* list )
{
	return (list->length == ARRAY_MAX) ;
}

int mul_list_length( mul_list* list )
{
	return (list->length) ;
}

int insert_into_mul_list( mul_list* list , word element) 
{
	if ( is_mul_list_full(list) )
	{
		return 0 ;
	}
	else
	{
		list->length = list->length + 1 ;
		list->number[list->length - 1] = element ;
	}
}

void display_mul_list( mul_list list )
{
	int length = list.length ;
	for ( int i = length-1 ; i >= 0 ; --i )
	{
		printf( "%x " , list.number[i] ) ;
	}
}